const genStyle = (color1, color2) => ({
  color: {
    type: 'linear',
    x: 0,
    y: 0,
    x2: 0,
    y2: 1,
    colorStops: [{
      offset: 0,
      color: color1 // 0% 处的颜色
    }, {
      offset: 1,
      color: color2 // 100% 处的颜色
    }],
    globalCoord: false // 缺省为 false
  }
})
const colorList = [
  ['#343491', '#C849ED'],
  ['#009EB5', '#55F9F6']
]
const genData = (item, idx) => {
  const itemStyle = idx < colorList.length ? genStyle(...colorList[idx]) : {}
  return Object.assign({}, item, {
    itemStyle
  })
}

const a = [{
    data: 123,
    name: 'A'
  },
  {
    data: 456,
    name: 'B'
  },
  {
    data: 456,
    name: 'C'
  }
]

const c = a.map(genData)

console.log(JSON.stringify(c));